﻿using IterationLife.Educations.Models;
using Util;
using Util.Maps;

namespace IterationLife.PlatformBackEnd.AppServices.Dtos.Educations {
    /// <summary>
    /// 科目能力数据传输对象扩展
    /// </summary>
    public static class SubjectAbilityDtoExtension {
        /// <summary>
        /// 转换为科目能力实体
        /// </summary>
        /// <param name="dto">科目能力数据传输对象</param>
        public static SubjectAbility ToEntity( this SubjectAbilityDto dto ) {
            if ( dto == null )
                return new SubjectAbility();
            return dto.MapTo( new SubjectAbility( dto.Id.ToGuid() ) );
        }
        
        /// <summary>
        /// 转换为科目能力数据传输对象
        /// </summary>
        /// <param name="entity">科目能力实体</param>
        public static SubjectAbilityDto ToDto(this SubjectAbility entity) {
            if( entity == null )
                return new SubjectAbilityDto();
            return entity.MapTo(new SubjectAbilityDto());
        }
    }
}
